from __future__ import absolute_import, unicode_literals
from .utils import update_pref, create_income
import time
from finance_c2c import celery_app as app
from .models import SupplyOrder

@app.task()
def async_task(**kwargs):
    time.sleep(10)
    return str("123")


@app.task()
def task_create_income(s_order_id, **kwargs):
    s_order = SupplyOrder.objects.get(id=s_order_id)
    create_income(s_order)


@app.task()
def task_update_pref(s_order_id, **kwargs):
    s_order = SupplyOrder.objects.get(id=s_order_id)
    update_pref(s_order)
